Hi Michael,
I'm not sure of the best approach. I assume the unclamping is too slow for KFLOP to detect that motion is started and to immediately unclamp automatically?
You probably will want to change your M104 C Program to include waiting until the mechanism is really unclamped.
You might change the M103 C program to disable the Z axis as soon as it is clamped. This would prevent any attempted motion. I think you would also need to remove it from the Coordinate System with a DefineCoordSystem() call. M104 would then need to re-enable the axis and re-enstate the axis into the Coordinate System.
Otherwise you could write a "watchdog" type of program that would monitor the clamped status an also the Z axis commanded destination . As soon as the slightest motion was detected while clamped it could immediately disable the axis. This watchdog loop would be added to the end of your Init.c program so it would loop forever after the initialization is complete.
HTH
TK
| Group: DynoMotion |
Message: 4735 |
From: mrosenfield2 |
Date: 5/2/2012 |
| Subject: Re: programming question |
Whit the axis clamped, there will be no motion!
Or did you mean commanded motion?
I'm not using a M104 C program - I just programmed some of the User M functions in KMotionCNC.
How would I tie C program to disable an axis to the Mcode?
I would need to remove it from the coordinate system - I tried disabling the knee axis today (because I didn't need it) and the GCode interpreter gave an error and aborted, even though the GCode didn't tell the knee to move.
How would the watchdog monitor axis movement?
Thanks,
Michael
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Michael,
> Â
> I'm not sure of the best approach. I assume the unclamping is too slow for KFLOP to detect that motion is started and to immediately unclamp automatically?
> Â
> You probably will want to change your M104 C Program to include waiting until the mechanism is really unclamped.
> Â
> You might change the M103 C program to disable the Z axis as soon as it is clamped. This would prevent any attempted motion. I think you would also need to remove it from the Coordinate System with a DefineCoordSystem() call. M104 would then need to re-enable the axis and re-enstate the axis into the Coordinate System.
> Â
> Otherwise you could write a "watchdog" type of program that would monitor the clamped status an also the Z axis commanded destination . As soon as the slightest motion was detected while clamped it could immediately disable the axis. This watchdog loop would be added to the end of your Init.c program so it would loop forever after the initialization is complete.
> Â
> HTH
> TK
>
> From: mrosenfield2 <mrosenfield@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, May 1, 2012 9:49 PM
> Subject: [DynoMotion] programming question
>
>
> Â
> Tom,
> To make my mill's z-axis usable, I have to clamp it in place after a Z move, and before any X or Y moves. I also have to insure the clamp is released before commanding any Z moves.
> This clamping is needed for milling cycles, but not used for drilling cycles.
> The clamp is air powered, and currently set up to clamp with an M103 and release with an M104.
> I have a proximity switch that I will wire to a spare KFlop input to sense when the clamp is released.
>
> What is the best way to prevent the G-code from commanding a Z axis move if the clamp is not released?
> I can do a bit-test and disable the axis if the proximity switch is set, and enable the axis if it is clear, but where should I put this code?
> Thanks,
> Michael
>
|
|
| Group: DynoMotion |
Message: 4736 |
From: Tom Kerekes |
Date: 5/2/2012 |
| Subject: Re: programming question |
Hi Michael,
Yes as soon as the commanded motion begins to move it could release the clamp. What do you think? Would this work without causing damage? As it would probably be the simplest solution.
Regards
TK
| Group: DynoMotion |
Message: 4737 |
From: Michael Rosenfield |
Date: 5/2/2012 |
| Subject: Re: programming question |
The encoder will not move with the clamp in place - the drive belt will slip first. Since it is a toothed belt, if it slips much, it will become toothless. So, unless something can watch for motion commands, or non-zero output to the amplifier, I will have to put proper MCodes into the part file. As long as I don't make any mistakes with the part file there will be no problems. But I want to monitor this in hardware so that in case an error is made in the part program, nothing gets broken. So I think a C program that monitors the clamp position and disables the axis when clamped, and enables it when unclamped, is the way to go. I'd just need to make sure that there is enough time between M104 and G0Z0 for the axis to wake up and start moving. Does the KFlop keep track of axis position when the axis is disabled and DefineCoordSystem is configured to ignore that axis? Michael
| Group: DynoMotion |
Message: 4738 |
From: Tom Kerekes |
Date: 5/2/2012 |
| Subject: Re: programming question |
Hi Michael,
I think you missed my point/question. I realize that it is a bad idea to move while clamped. But what about if we unclamped and started to move at the same time? If the unclamp happens quickly before there is substantial motor torque buildup then there might not be a problem. And this would only happen in the case where you forgot to unclamp beforehand. But I'll assume that is a bad idea...
I'm also thinking that if the only thing that ever clamps also disables the axis then maybe you don't need a watchdog loop to monitor the clamp.
But anyway attached is a program that should monitor the clamp and enable/disable the axis whenever the clamp state changes
Regards
TK
| Group: DynoMotion |
Message: 4739 |
From: Michael Rosenfield |
Date: 5/2/2012 |
| Subject: Re: programming question [1 Attachment] |
The attached program should be perfect - thank you! Since the clamp is air powered, there are too many components in the system to just assume it unclamps when told to do so. It takes probably 0.5 seconds for the unclamp operation, starting with the KFlop output bit, but again, that assumes all the air stuff works properly. I have noticed that sometime running the init program will change the machine zeros. Is this supposed to happen? I'm concerned that if I disable the axis I'll lose position. I've attached my init file for reference. Thanks for all your help, Tom! Michael
| Group: DynoMotion |
Message: 4837 |
From: Michael Rosenfield |
Date: 5/8/2012 |
| Subject: Re: programming question |
Tom, I implimented the axis clamps for the quill and knee, using the attached code. When I single step thru the attached GCode file, it works fine. When I hit Run, it executes to the clamping point, and then I get the attached error message. Looks like I need to insert a time delay somewhere, or something. What would you suggest? Thanks, Michael
| Group: DynoMotion |
Message: 4838 |
From: Bengt Sjoelund |
Date: 5/8/2012 |
| Subject: Re: programming question |
Hi Michael,
On my milling machine I have a clamp/brake on Z-axis (knee)that is controlled by the axis driver GD VSD-XE. Have a look at your drivers documentation and see if they have Brake control.
Cheers
Bengt
--- In DynoMotion@yahoogroups.com, Michael Rosenfield <mrosenfield@...> wrote:
>
>
> Tom,I implimented the axis clamps for the quill and knee, using the attached code.When I single step thru the attached GCode file, it works fine.When I hit Run, it executes to the clamping point, and then I get the attached error message.Looks like I need to insert a time delay somewhere, or something.What would you suggest?Thanks,Michael
> From: mrosenfield@...
> To: dynomotion@yahoogroups.com
> Subject: RE: [DynoMotion] Re: programming question
> Date: Wed, 2 May 2012 16:15:39 -0700
>
>
>
>
>
> The encoder will not move with the clamp in place - the drive belt will slip first. Since it is a toothed belt, if it slips much, it will become toothless.
> So, unless something can watch for motion commands, or non-zero output to the amplifier, I will have to put proper MCodes into the part file. As long as I don't make any mistakes with the part file there will be no problems. But I want to monitor this in hardware so that in case an error is made in the part program, nothing gets broken.
> So I think a C program that monitors the clamp position and disables the axis when clamped, and enables it when unclamped, is the way to go. I'd just need to make sure that there is enough time between M104 and G0Z0 for the axis to wake up and start moving.
> Does the KFlop keep track of axis position when the axis is disabled and DefineCoordSystem is configured to ignore that axis?
>
> Michael
>
> To: DynoMotion@yahoogroups.com
> From: tk@...
> Date: Wed, 2 May 2012 15:53:34 -0700
> Subject: Re: [DynoMotion] Re: programming question
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hi Michael,
>
> Yes as soon as the commanded motion begins to move it could release the clamp. What do you think? Would this work without causing damage? As it would probably be the simplest solution.
>
> Regards
> TK
>
>
>
>
>
> From: mrosenfield2 <mrosenfield@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, May 2, 2012 3:22 PM
> Subject: [DynoMotion] Re: programming question
>
>
>
>
>
> Whit the axis clamped, there will be no motion!
> Or did you mean commanded motion?
>
> I'm not using a M104 C program - I just programmed some of the User M functions in KMotionCNC.
> How would I tie C program to disable an axis to the Mcode?
>
> I would need to remove it from the coordinate system - I tried disabling the knee axis today (because I didn't need it) and the GCode interpreter gave an error and aborted, even though the GCode didn't tell the knee to move.
>
> How would the watchdog monitor axis movement?
>
> Thanks,
> Michael
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Michael,
> > Â
> > I'm not sure of the best approach. I assume the unclamping is too slow for KFLOP to detect that motion is started and to immediately unclamp
> automatically?
> > Â
> > You probably will want to change your M104 C Program to include waiting until the mechanism is really unclamped.
> > Â
> > You might change the M103 C program to disable the Z axis as soon as it is clamped. This would prevent any attempted motion. I think you would also need to remove it from the Coordinate System with a DefineCoordSystem() call. M104 would then need to re-enable the axis and re-enstate the axis into the Coordinate System.
> > Â
> > Otherwise you could write a "watchdog" type of program that would monitor the clamped status an also the Z axis commanded destination . As soon as the slightest motion was detected while clamped it could immediately disable the axis. This watchdog loop would be added to the end of your Init.c program so it would loop forever after the initialization is complete.
> > Â
> > HTH
> >
> TK
> >
> > From: mrosenfield2 <mrosenfield@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Tuesday, May 1, 2012 9:49 PM
> > Subject: [DynoMotion] programming question
> >
> >
> > Â
> > Tom,
> > To make my mill's z-axis usable, I have to clamp it in place after a Z move, and before any X or Y moves. I also have to insure the clamp is released before commanding any Z moves.
> > This clamping is needed for milling cycles, but not used for drilling cycles.
> > The clamp is air powered, and currently set up to clamp with an M103 and release with an M104.
> > I have a proximity switch that I will wire to a spare KFlop input to sense when the clamp is released.
> >
> > What is the best way to prevent the G-code from commanding a Z axis move if the clamp is
> not released?
> > I can do a bit-test and disable the axis if the proximity switch is set, and enable the axis if it is clear, but where should I put this code?
> > Thanks,
> > Michael
> >
>
|
|
| Group: DynoMotion |
Message: 4839 |
From: Michael Rosenfield |
Date: 5/8/2012 |
| Subject: Re: programming question |
Thanks, Bengt, but this is one I built myself. Michael
| Group: DynoMotion |
Message: 4845 |
From: Tom Kerekes |
Date: 5/8/2012 |
| Subject: Re: programming question [3 Attachments] |
Hi Michael,
You didn't explain how you have M103 and M104 configured. Maybe just to set/clear a bit?
Yes you could put delays in the GCode or the MCode that would probably work but probably the best solution would be to change the M103/M104 to be C programs that activate the bit and actually wait until the input status changes.
Something like:
SetBit(XXX); while (!ReadBit(138)) // read the input { WaitNextTimeSlice(); }
Also make sure when you assign the C Program to the MCode that the option to Exec/Wait/Sync is selected so that the Interpreter will wait for the C program to complete before going on.
Regards
TK
PS I like your Init.c program it is well written
| Group: DynoMotion |
Message: 4847 |
From: Michael Rosenfield |
Date: 5/8/2012 |
| Subject: Re: programming question |
Yes, M103/4 just set or clear the bit that controls the air valve. How does the "unexpected coordinated motion buffer underflow" come into play? Is it trying to plan a z move with the z axis disabled, or is something else going on? Is the TP looking ahead quicker than the clamp cylinder's proximity switch can signal the KFlop to shut down the Z axis? Thanks for the compliment - getting this mill up has taken 3 times longer that I had planned, but it's looking good now. Regards, Michael
| Group: DynoMotion |
Message: 4850 |
From: Tom Kerekes |
Date: 5/8/2012 |
| Subject: Re: programming question |
Hi Michael,
Yes sorry for the poor error message. When an axis suddenly becomes disabled KFLOP stops executing coordinated motion which appears to KMotionCNC as a buffer underrun.
Regards
TK
| Group: DynoMotion |
Message: 4854 |
From: Michael Rosenfield |
Date: 5/8/2012 |
| Subject: Re: programming question |
So, will this error be corrected by using the C code below to switch the air valve, and waiting in the loop til it has switched?
| Group: DynoMotion |
Message: 4859 |
From: Tom Kerekes |
Date: 5/8/2012 |
| Subject: Re: programming question |
Yes it should
| Group: DynoMotion |
Message: 4866 |
From: Michael Rosenfield |
Date: 5/8/2012 |
| Subject: Re: programming question |
Ok, got that all programmed up, and it works great - thanks! If the air is off, the program just hangs, which is a good thing. Is there a simple way to wait 10 seconds and if it doesn't see the bit change, generate an error message on the screen, and maybe terminate the GCode execution? Regards, Michael
| Group: DynoMotion |
Message: 4871 |
From: Tom Kerekes |
Date: 5/9/2012 |
| Subject: Re: programming question |
Hi Michael,
That should be possible. See the example:
KFLOPtoPCCmdExamples.c
for how to do things like display message boxes and EStop from a KFLOP C Program.
You must include some helper functions into your C code (at the end) and their respective prototype definitions (at the beginning).
You will also need to record the time when you start waiting for an input and while waiting test if too much time has elapsed. WaitNextTimeSlice() returns the current time that can be used for this.
I've attached an example. But I haven't tested it.
Regards
TK
| | | | | | | | | | | | | | | | | | | | | | | | | | | |